package com.mall.manager.allpeoplestatistics.controller;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.collections.MapUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.util.WebUtils;

import com.mall.manager.allpeoplestatistics.service.AllPeopleStatisticsService;
import com.mall.untils.Page;
/**
 * @全球数量统计
 * @author liugb
 * @date 2016 7 14
 */
@RequestMapping("/manager")
@Controller
public class AllPeopleStatisticsController {
	@Resource
	AllPeopleStatisticsService allPeopleStatisticsService;
	 /**
	   * 全球数量统计列表
	   * @param request
	   * @param response
	   * @param modelMap
	   * @return
	   */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/manager_allpeople_list")
    public String manager_singleTopicDay_list(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) {
    	Page page=allPeopleStatisticsService.manager_allPeople_list(request);
    	Map<String,Object> paraMap = WebUtils.getParametersStartingWith(request, "");
		String update_time = MapUtils.getString(paraMap, "update_time");
		if(update_time!=null&&!update_time.equals("")){
			modelMap.addAttribute("update_time",update_time);
		}
     	if(null!=page){
	     	modelMap.addAttribute("manager_allPeople_list", (List<Map<String,Object>>)page.getResult());
	     	int totalpagecount = page.getTotalPageCount();
	     	modelMap.addAttribute("totalpagecount", totalpagecount);
	     	int currentpageno = page.getCurrentPageNo();
	     	modelMap.addAttribute("currentpageno", currentpageno);
	     	int previouspage = page.getCurrentPageNo() <= 1 ? 1 : page
					.getCurrentPageNo() - 1;
	     	modelMap.addAttribute("previouspage", previouspage);
	     	int nextpage = page.getCurrentPageNo() >= page.getTotalPageCount() ? page
					.getTotalPageCount() : page.getCurrentPageNo() + 1;
			modelMap.addAttribute("nextpage", nextpage);
			List<Integer> showNumList = page.getShowNumList();
			modelMap.addAttribute("pagenumlist", showNumList);
     	}
    	return "allpeoplestatistics/nationwide_message_list";
    }
	
}
